<html>
		<head>
			<link rel="stylesheet" href="../css/styles.css" />
			<!-- <link rel="stylesheet" href="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.css"> -->
			<link rel="stylesheet" href="../css/jquery.mobile-1.3.1.min.css">
			<link rel="stylesheet" href="file:///android_asset/css/in.css">
			<!-- Extra Codiqa features -->
			<link rel="stylesheet" href="codiqa.ext.css">
			<!-- jQuery and jQuery Mobile -->
			<script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
			<script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
			<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
			<!-- Extra Codiqa features -->
			<script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
			<script src="file:///android_asset/js/login.js"></script>
		</head>
		<body>
			<div class="ui-header ui-bar-b" align="center" data-theme="b" data-role="header" role="banner">
				<p style="padding:10px;">
				<font size="3"> Boulder Search Results </font></p>
				<img style="float:right;height:35px; margin:-37px 6px 0px 0px;width:50px;border-radius:10px;" src="../images/signout.png" onclick="signout()">
			</div>
			<div class="container">
				<form>
					<table id="customers">
					</table><br>
					<div>
						<a href="#" style="float:left;margin:0px 10px 0px 0px;"> <img src="../images/cancel.png" onclick="goBack()" width = "120" height="40"></a> 
						<a href="#" style="float:right;margin:0px 0px 0px 10px;"> <img src="../images/continue.png" onclick="NextPage()" width = "120" height="40"></a>           
					</div>
				</form>
			</div>
			<div><p style="font-size:75pt;">&nbsp;</p></div>
			<div style="background-image: url(../images/topbar.png); bottom:0;text-align:center;margin:0px 0px 0px 0px;" id="sample" class="ui-footer-fixed " > 
				<div style="margin:8px 0px -7px 17px;">
					<img  style="margin:0px -1px 13px -17px;" class="folder" src="../images/folder.png"  height="40" width="40" onclick="folder()">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/settings.png" height="40" width="40" onclick="settings()">
					<img  style="margin:0px -1px 13px 19px;" class="" src="../images/home.png" height="40" width="40" onclick="home()">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/boulder.png" height="40" width="40" onclick="boulder()">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/route.png" height="40" width="40" onclick="route()">
				</div>
			</div>
		</body>
</html>

<script type="text/javascript" charset="utf-8" src="file:///android_asset/js/cordova.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
	<script>
	function signout(){
		window.location='index_login.html';
	}
	function folder(){
		<!-- window.location='http://forerunnerpro.com/?nr=0'; -->
		navigator.app.loadUrl('http://forerunnerpro.com/?nr=0', { openExternal:true });
	}
	function settings(){
		window.location='settings.html';
	}
	function home(){
		window.location='option.html';
	}
	function boulder(){
		window.location='boulder_option.html';
	}
	function route(){
		window.location='route_option.html';
	}
	var token1=encodeURIComponent(window.localStorage["token"]);
	var arr1 = [];var arr2 = [];var arr3 = [];var arr4 = [];var arr5 = [];var arr6 = [];var arr7 = [];var arr8 = [];var arr9 = [];var arr10 = [];
	document.addEventListener("deviceready", updateRopeRoute, false);
	function updateRopeRoute(){
		 var table='<tr><th height="10px" width="12%">Area</th><th width="14%">Grade</th><th width="13%">Color</th><th>Name</th><th width="21%">Set Date</th><th width="10%">&nbsp;&nbsp;&nbsp;</th></tr>';
		 $.ajax({
			type: "POST",
			url: window.localStorage["url"]+'/boulderroutesforupdate?token='+token1,
			contentType: "application/json; charset=utf-8",
			data:window.localStorage["searchValue"],
			success: function(data){
				if(data.status == "SUCCESS"){
					$.each(data.data, function(key,value){
						if(key == 'results') {
							var i=0;
							$.each(value, function(key1,value1){
								if(value1.status==1){
									table+='<tr height="10px" id='+i+'><td height="10px" style="word-break:break-word;">'+value1.areaName+'</td><td style="word-break:break-word;">'+value1.gradeName+'</td><td style="word-break:break-word;">'+value1.colorName+'</td><td style="word-break:break-word;">'+value1.routeName+'</td><td>'+value1.createDate+'</td><td><input type="radio" id="RadioButton" name="RadioButton"  onclick="routename('+i+')"></td></tr>';
									arr1.push(value1.areaName);
									arr2.push(value1.gradeName);
									arr3.push(value1.colorName);
									arr4.push(value1.routeName);
									arr5.push(value1.createDate);
									arr6.push(value1.routeTypeName);
									arr7.push(value1.climbStyleName);
									arr8.push(value1.locationName);
									arr9.push(value1.routeId);
									arr10.push(value1.userId);
									i++;
								}
							});
						}
					});
					$("#customers").html( table );	
				}else if(data.errorCode=="100"){
					navigator.notification.alert("Please Sign In");
					window.location='index_login.html';
					return false;
				}
			}					
		});			
	}
	function routename(id){
		window.localStorage["areaName"]=arr1[id];
		window.localStorage["gradeName"]=arr2[id];
		window.localStorage["colorName"]=arr3[id];
		window.localStorage["routeName"]=arr4[id];
		window.localStorage["createDate"]=arr5[id];
		window.localStorage["routeTypeName"]=arr6[id];
		window.localStorage["climbStyleName"]=arr7[id];
		window.localStorage["locationName"]=arr8[id];
		window.localStorage["routeId"]=arr9[id];
		window.localStorage["userId"]=arr10[id];
		}
	function goBack(){
		window.location='update_boulder_strip.html';
	}
	function NextPage(){
		var myRadio = jQuery("input[name=RadioButton]");
		var SelectedRadio = myRadio.filter(":checked");
		var count=0;
		var radio=document.getElementsByTagName('input');
		for(var i=0;i<radio.length;i++){
			if(radio[i].type=='radio'&&radio[i].checked==true){
			count++;
			}
		}
		if(count==1){	
			$.ajax({
					type: "POST",
					url: window.localStorage["url"]+'/striproute/'+window.localStorage["routeId"]+'?stripperId='+window.localStorage["userId"]+'&token='+token1,
					contentType: "application/json; charset=utf-8",
					dataType: "json",
					success: function(data){
							navigator.notification.alert("The Route Database Has Been Updated");
							window.location='boulder_option.html'; 
					}
			});
		}
		else{
			navigator.notification.alert( "Please select your Radiobutton" );}
	}
	</script>
